package com.tgu.home_action.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.sql.Timestamp;
import java.util.Date;

@Data
@ApiModel(description = "地区")
public class Place {
    @ApiModelProperty("省")
    private String province;
    @ApiModelProperty("市")
    private String city;
    @ApiModelProperty("区")
    private String district;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("时间")
    private Timestamp time;
    @ApiModelProperty("案件数量")
    private int caseNum;
    @JsonFormat(pattern = "yyyy-MM-dd HH", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH")
    @ApiModelProperty("案件发生小时")
    private Date hourTime;

    public Place() {
    }

    public Place(String province, String city, String district) {
        this.province = province;
        this.city = city;
        this.district = district;
    }

    public VolunteerInformation getVolunteerInformation(){
        VolunteerInformation volunteerInformation=new VolunteerInformation();
        volunteerInformation.setProvince(this.province);
        volunteerInformation.setCity(this.city);
        volunteerInformation.setDistrict(this.district);
        return volunteerInformation;
    }

    public Case getCase(){
        Case nowCase=new Case();
        nowCase.setProvince(province);
        nowCase.setCity(this.city);
        nowCase.setDistrict(this.district);
        return nowCase;
    }

    public Admin getAdmin() {
        Admin admin=new Admin();
        admin.setProvince(province);
        admin.setCity(this.city);
        admin.setDistrict(this.district);
        return admin;
    }
}
